package com.zzyl.controller.customer;


import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.entity.NursingProject;
import com.zzyl.service.CustomerOrdersService;
import com.zzyl.service.CustomerReservationService;
import com.zzyl.vo.NursingPlanVo;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.zzyl.base.ResponseResult.success;

@RestController
@RequestMapping("/customer/orders")
@Api(tags = "服务项接口")
public class CustomerOrdersController {

    @Autowired
    private CustomerOrdersService customerOrdersService;


    /**
     * 分页查询护理项目列表
     * @param name
     * @param pageNum
     * @param pageSize
     * @param status
     * @return
     */

    @GetMapping("/project/page")
    @ApiOperation(value = "分页查询护理项目列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "护理项目名称", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态", required = false, dataType = "int", paramType = "query"),

    })
    public ResponseResult<PageResponse<NursingProjectVo>> selectByPage
            (String name, Integer pageNum, Integer pageSize, Integer status) {
        PageResponse<NursingProjectVo> pageInfo =
                customerOrdersService.selectByPage(name, pageNum, pageSize, status);
        return success(pageInfo);

    }

/**
 * 根据编号查询护理项目信息
 */
    @GetMapping("/project/{id}")
    @ApiOperation(value = "根据编号查询护理项目信息")
    public ResponseResult<NursingProjectVo> getById(@PathVariable Long id){
      NursingProjectVo nursingProjectVo=  customerOrdersService.getById(id);
      return success(nursingProjectVo);
    }






}
